home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00009_Garnish well.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  3.5 KB  |  138 lines

  1. property pIngredient, pOrigIngredient, pDraggingMember, pSpr, pTimer
  2. global gWellSprite
  3.  
  4. on beginSprite me
  5.   pSpr = sprite(me.spriteNum)
  6.   pOrigMember = pSpr.member
  7.   pOrigIngredient = pIngredient
  8.   pDraggingMember = nextMember(pOrigMember)
  9. end
  10.  
  11. on mPickMeUp me, newIngredient, pickupLoc
  12.   replaceDraggingAnything()
  13.   returnToBar(VOID, 1)
  14.   if not voidp(newIngredient) then
  15.     pIngredient = newIngredient
  16.   end if
  17.   sendSprite(gWellSprite, #mDragWellItem, pSpr, pDraggingMember, VOID, pIngredient)
  18. end
  19.  
  20. on rightMouseDown me
  21.   if the stage = the activeWindow then
  22.     pIngredient = twistIt(pOrigIngredient)
  23.     showToolTip(pSpr, checkForTwist(pIngredient))
  24.     mPickMeUp(me, pIngredient)
  25.   end if
  26. end
  27.  
  28. on mouseUp
  29.   if the doubleClick and isLemonOrLime(pOrigIngredient) then
  30.     pIngredient = twistIt(pOrigIngredient)
  31.     showToolTip(pSpr, pIngredient)
  32.   end if
  33. end
  34.  
  35. on mouseDown me
  36.   pIngredient = pOrigIngredient
  37.   if the doubleClick then
  38.     exit
  39.   end if
  40.   if draggingAnything() then
  41.     replaceDraggingAnything()
  42.   else
  43.     if modifierDown() and isLemonOrLime(pOrigIngredient) then
  44.       pIngredient = twistIt(pOrigIngredient)
  45.       showToolTip(pSpr, pIngredient)
  46.     end if
  47.     menuDown = nowTicks()
  48.     repeat while the stillDown
  49.       if ticksSince(menuDown) > 45 then
  50.         pIngredient = twistIt(pOrigIngredient)
  51.       end if
  52.       if ticksSince(menuDown) > 15 then
  53.         forceToolTip(pSpr, checkForTwist(pIngredient), the clickLoc)
  54.       end if
  55.       checkElapsedTime()
  56.       updateStage()
  57.     end repeat
  58.     showToolTip(pSpr, checkForTwist(pIngredient))
  59.     mPickMeUp(me, pIngredient)
  60.   end if
  61. end
  62.  
  63. on mDoneDragging me
  64.   global gBarTopManager, gSoundFXchan, gLastIngredient, gTwistTips
  65.   if inBonusMode() then
  66.     storeLastIngredient(checkForTwist(pIngredient))
  67.     if not dropWellItemInBonusRound(gLastIngredient) then
  68.       gLastIngredient = 0
  69.     end if
  70.     exit
  71.   end if
  72.   barGlass = overGarnishableItem(me)
  73.   if barGlass then
  74.     barSlot = glassSpriteToBarSlot(barGlass)
  75.     glassType = getBarTopGlass(gBarTopManager, barSlot)
  76.     startGlass = glassPrefix(glassType) & "_"
  77.     pIngredient = checkForTwist(pIngredient)
  78.     if isTwist(pIngredient) then
  79.       garnishedGlass = startGlass & "twist"
  80.       gTwistTips = 0
  81.     else
  82.       garnishedGlass = startGlass & pIngredient
  83.     end if
  84.     setBarTopGlass(gBarTopManager, barSlot, member(garnishedGlass), glassType, 1, VOID, pIngredient)
  85.     clickSound()
  86.   else
  87.     alertBeep()
  88.   end if
  89. end
  90.  
  91. on overGarnishableItem me
  92.   garnishableList = [79, 83, 87, 81, 85, 89]
  93.   repeat with X in garnishableList
  94.     if sendSprite(X, #mOverItem, pSpr, the mouseLoc, pIngredient) then
  95.       if (X = 89) or (X = 85) or (X = 81) then
  96.         return X - 2
  97.         next repeat
  98.       end if
  99.       return X
  100.     end if
  101.   end repeat
  102.   return 0
  103. end
  104.  
  105. on getPropertyDescriptionList me
  106.   wellList = [#olive, #lemonWedge, #limeWedge, #cherry, #orangeWedge, #salt]
  107.   myList = [#pIngredient: [#default: #olive, #format: #symbol, #comment: "Infinite supply of:", #range: wellList]]
  108.   return myList
  109. end
  110.  
  111. on mouseEnter me
  112.   pIngredient = pOrigIngredient
  113.   if not draggingAnything() then
  114.     pTimer = nowTicks()
  115.     showToolTip(pSpr, checkForTwist(pIngredient))
  116.   end if
  117. end
  118.  
  119. on mouseLeave me
  120.   if not draggingAnything() then
  121.     hideToolTip()
  122.   end if
  123. end
  124.  
  125. on mouseWithin me
  126.   if not draggingAnything() then
  127.     showToolTip(pSpr, checkForTwist(pIngredient))
  128.   end if
  129.   if draggingAnything() then
  130.   else
  131.     if tipTickRange(pTimer) then
  132.       forceToolTip(pSpr, checkForTwist(pIngredient))
  133.     else
  134.       dismissToolTip()
  135.     end if
  136.   end if
  137. end
  138.